function bar() {
  console.log(myName);
}

function foo() {
  var myName = 'hb'
  bar()
  console.log(myName);
}

var myName = 'huangbo'
foo()